import {createWebHashHistory, createRouter} from 'vue-router'
const history = createWebHashHistory()
// @ts-ignore
const router = createRouter({
  history,
  routes: [
    {
      path: '/',
      name: 'demo',
      component: () => import('@/demos/demo.vue'),
      redirect: '/animation',
      children: [
        {
          path: '/animation',
          name: 'animation',
          component: () => import('@/demos/animation.vue'),
          meta: {
            title: 'animation'
          }
        },
        {
          path: '/todoList',
          name: 'todoList',
          component: () => import('@/demos/todoList/todolist.vue'),
          meta: {
            title: 'todoList'
          }
        }, {
          path: '/about',
          name: 'about',
          component: () => import('@/demos/todoList/about.vue'),
          meta: {
            title: 'about'
          }
        },
        {
          path: '/demoUse',
          name: 'demoUse',
          component: () => import('@/demos/demoUse.vue'),
          meta: {
            title: 'demoUse'
          }
        }, {
          path: '/zhihu',
          name: 'zhihu',
          component: () => import('@/demos/zhihu/index.vue'),
          meta: {
            title: 'zhihu'
          }
        }
      ]
    },
    {
      path: '/mupReport',
      name: 'mupReport',
      component: () => import('@/views/multipleReport/index.vue'),
      meta: {
        title: '报告'
      }
    }]
})
router.beforeResolve(to => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
})
export default router
